package com.pidan.pojo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;

import java.io.Serializable;

/**
 * 商品类
 */
@ExcelTarget("courseEntity")
public class Product implements Serializable {

    // 商品id
    @Excel(name = "商品id")
    private String productId;

    // 商品名称
    @Excel(name = "商品名称")
    private String name;

    // 商品主图
    @Excel(name = "商品主图")
    private String imgURL;

    // 商品价格(单位：元)
    @Excel(name = "商品价格(单位：元)")
    private Double price;

    // 佣金
    @Excel(name = "佣金")
    private Double commission;

    // 优惠券面额
    @Excel(name = "优惠券面额")
    private Double discount;

    // 优惠券口令(300天内有效)
    @Excel(name = "优惠券淘口令(30天内有效)")
    private String word;

    public Product() {

    }

    public Product(String productId, String name, String imgURL, Double price, Double commission, Double discount, String word) {
        this.productId = productId;
        this.name = name;
        this.imgURL = imgURL;
        this.price = price;
        this.commission = commission;
        discount = discount;
        this.word = word;
    }

    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getImgURL() {
        return imgURL;
    }

    public void setImgURL(String imgURL) {
        this.imgURL = imgURL;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Double getCommission() {
        return commission;
    }

    public void setCommission(Double commission) {
        this.commission = commission;
    }

    public Double getDiscount() {
        return discount;
    }

    public void setDiscount(Double discount) {
        this.discount = discount;
    }

    public String getWord() {
        return word;
    }

    public void setWord(String word) {
        this.word = word.replace("淘口令","");
    }

    @Override
    public String toString() {
        return "商品名称：  " + name + "\n商品价格：  " + price +"\n优惠劵金额:  "+ discount +"\n券后价格：  "+String.format("%.2f",price-discount)+"\n淘口令  ：" + word;
    }
}
